import org.jcp.xml.dsig.internal.dom.DOMUtils;

import java.util.*;

public class Personss {
    public static void main(String[] args) {
       Persons p1 = new Persons("1","小明","18", Arrays.asList("牛奶","香蕉","红烧肉","沙拉"),new String[] {"篮球","足球","排球"});
       Persons p2 = new Persons("2","小李","20", Arrays.asList("核桃","栗子","土豆","红薯"),new String[] {"篮球","台球","乒乓球"});
       //获得小李的食物兴趣
        List<String> chili = p1.getChiLike();
        //获得小ming的食物兴趣
        List<String> chiming = p2.getChiLike();
        //取出小李的食物兴趣
        for (int i =0 ; i < chili.size();i++){
             String li = chili.get(i);

            //取出小明的食物兴趣
             String ming = chiming.get(i);

            // 把小李的追加给小明
             String lm = ming + li;

             //放入追加完的数据给小明
             chiming.set(i,lm);
        }
       //三种遍历求小明的兴趣爱好
        for (String s : chiming){
            System.out.println(s);
        }

       for(int i = 0 ; i < chiming.size(); i++){
           String ss = chiming.get(i);
             System.out.println(ss);
       }

       Iterator<String> sss = chiming.iterator();
             while (sss.hasNext()){
             String next = sss.next();
             System.out.println(next);
        }
        System.out.println("************************************************************");

         // 从p1中取出体育爱好
             String[] all = p1.getTiYu();
             for(String s : all){
                 System.out.println(s);
             }
        // 从p2中取出体育爱好
             String[] all2 = p2.getTiYu();
             for (String strings2 :all2){
                 System.out.println(strings2);
             }
        System.out.println("__________________________________________________________________________________");
        HashSet<String> tt = new HashSet<String>();
             for (String ss : all){
                 tt.add(ss);
             }
             for (String sa : all2){
                 tt.add(sa);
             }
             for (String qu:tt){
                 System.out.println(qu);
             }


    }
}
